<!DOCTYPE html>
<html>
	<head>

		<title></title>
	</head>
	<body>
		<script>
		//数字处理问题
		// 一个数字倒序输出  各位数相加之和
		//用户输入的数字位数不确定
		// var i= 1234  获取4  i%10  4     获取3   (i-ge)/10%10  3  获取2  
		   
		  /* //1234
		   var ge = i%10;
		   document.write(ge);
		   i = (i-ge)/10;
		   // 123 
		   var shi = i%10;
		   document.write(shi);
		   i = (i-shi)/10;
		   //12 
		   var bai = i%10;
		   document.write(bai);
		   i = (i-bai)/10;
		   //1
		   var qian = i%10;
		   document.write(qian);
		   i = (i-qian)/10; */
		   //0
		   var i =567;
		   var total =0;
		   while(i!=0){
			   var ge = i%10;
			   total = total +ge;
			   document.write(ge);
			   i = (i-ge)/10;
		   }
		   document.write("各位数相加之和为 "+total);
		</script>
	</body>
</html>
